#pragma once

#include <algorithm>
#include <string>
#include <cstdio>

namespace SmsAlg
{
    bool icase_less (char x, char y) 
    {
        return toupper(x) < toupper(y);
    }

    bool icase_wchar_less (wchar_t x, wchar_t y) 
    {
        return toupper(x) < toupper(y);
    }



    /**
    * Returns true if two strings are ordered in alphabetical order. 
    * Comparison is case insensitive. 
    */
    bool NoCaseLess(const std::string & a, const std::string & b)
    {
        return std::lexicographical_compare(a.begin(), a.end(),
            b.begin(), b.end(), icase_less);
    }

    /**
    * Returns true if two strings are ordered in alphabetical order. 
    * Comparison is case insensitive. 
    */
    bool NoCaseLess(const std::wstring & a, const std::wstring & b)
    {
        return std::lexicographical_compare(a.begin(), a.end(),
            b.begin(), b.end(), icase_wchar_less);
    }


}